﻿ Ext.define('HIT.view.DealPrintComplexSearchWin', {
    extend: 'Ext.window.Window',
    alias: 'widget.printcomplexsearchwin',
//排序弹出窗口
    height:380,
    width:750,
    overlapHeader: false,
    preventHeader: true,
    layout: {
        type: 'border'
    },
    title: Share.T('高级查询'),
    closeAction:'hide',
        
    initComponent: function() {
        var me = this;
        this.title = Share.T('高级查询');     
        
        Ext.applyIf(me, {
             items: [{	
                     xtype:'panel',
                     autoScroll:true,
                     id:'print-complex-panel',
                     region: 'center'
              }
             ], 
             dockedItems: [
                      {
                          xtype: 'toolbar',
                          dock: 'top',
                          items: [
                              {
                                  xtype: 'button',
                                  text: Share.T('增加条件'),
                                  id: 'print-complex_add_condition',
                                  handler: function(){
                                	  var newPanel = Ext.create('widget.printcomplexsearchpanel');
                                	  Ext.getCmp('print-complex-panel').add(newPanel);
                                  }
                              },                                        
                              {
                                  xtype: 'button',
                                  text: Share.T('查询'),
                                  id:'complex-print-save'
                              },
                              {
                                  xtype: 'tbfill'
                              },
                              {
          					    xtype: 'combobox',	     
          					    id:'print-complex-state1',
          					    width: 130,
          					    editable : false,
          					    valueField: 'value',
								displayField: 'text',
								value :'0',
								store: new Ext.data.JsonStore({  
									proxy: { 
								        type: 'ajax', 
										url : ctx + '/getComboData',
										params:{
										},
										reader: { 
										    type: 'json', 
										totalProperty: '', 
										root: '' 
										} 
								 }, 
								fields:['text','value'], 
								    autoLoad:true 
								}),
								listeners : {
									beforerender:function(){
										this.store.removeAll();
										this.store.on('beforeload', function(store) {
											Ext.apply(store.proxy.extraParams , {
												type : 'dealcomplexsearch'
											});
										});
										this.store.load();
									}
								}
          					},{
          					    xtype: 'combobox',	      
          					    width: 130,
          					    id:'print-complex-state2',
          					    editable : false,
          					    queryMode:'local',
          					    displayField: 'text',
          					    valueField: 'value',
          					    value:'-1',
          					    store: new Ext.data.JsonStore({  
      	    					proxy: { 
      	        	                type: 'ajax', 
      	        	                url : ctx + '/getComboData',
      	        	                params:{
      	        	                },
      	        	                reader: { 
      	        	                    type: 'json', 
      	        	                    totalProperty: '', 
      	        	                    root: '' 
      	        	                } 
      	        	             }, 
      	        	            fields:['text','value'], 
      	        	            autoLoad:true 
	      				        }),
	      				        listeners : {
	      				        	beforerender:function(){
	      				        		this.store.removeAll();
	      				        		this.store.on('beforeload', function(store) {
	      				        			Ext.apply(store.proxy.extraParams , {
	      				        				type : 'dealcomplexsearch2'
	      				        			});
	      				        		});
	      				        		this.store.load();
	      				        	},
	      				        	expand : function(field, e) {
	      				        		this.store.filterBy(function(record,id){
	      				        			var retValue = record.get("value");
	      				                     if(retValue == '-1' || retValue == '2' || retValue == '3' || retValue == '4'){
	      				                         return true;
	      				                     }
	      				        		});
	      				        	}
	      				        }
          					  }
                          ]
                      }
                  ]
         });
        me.callParent(arguments);
    }
});